home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 May / EnigmA AMIGA RUN 18 (1997)(G.R. Edizioni)(IT)[!][issue 1997-05][EAR-CD II].iso / earcd / misc / emu / arosdev.lha / AROS / rom / utility / refreshtagitemclones.c < prev    next >
C/C++ Source or Header  |  1997-02-03  |  3KB  |  103 lines

  1. /*
  2.     Copyright (C) 1995-1997 AROS - The Amiga Replacement OS
  3.     $Id: refreshtagitemclones.c,v 1.7 1997/02/03 02:58:31 ldp Exp $
  4.  
  5.     Desc: RefreshTagItemClones()
  6.     Lang: english
  7. */
  8. #include "utility_intern.h"
  9.  
  10. /*****************************************************************************
  11.  
  12.     NAME */
  13. #include <utility/tagitem.h>
  14. #include <proto/utility.h>
  15.  
  16.         AROS_LH2(void, RefreshTagItemClones,
  17.  
  18. /*  SYNOPSIS */
  19.         AROS_LHA(struct TagItem *, clone, A0),
  20.         AROS_LHA(struct TagItem *, original, A1),
  21.  
  22. /*  LOCATION */
  23.         struct UtilityBase *, UtilityBase, 14, Utility)
  24.  
  25. /*  FUNCTION
  26.         If (and only if) the Tag list 'clone' was created by calling
  27.         CloneTagItems on the Tag list 'original', and the list original
  28.         has NOT been changed in any way, then this function will change
  29.         the list 'clone' back to its original state.
  30.  
  31.     INPUTS
  32.         original    - The source TagList (unaltered)
  33.         clone       - The destination TagList (MUST be allocated by
  34.                         CloneTagItems())
  35.  
  36.     RESULT
  37.         The second TagList now has the same values as the first.
  38.  
  39.     NOTES
  40.         If either of the inputs is NULL, then the function will not do
  41.         anything.
  42.  
  43.     EXAMPLE
  44.         struct TagItem *orig, clone;
  45.  
  46.         \* TagList orig has some values already *\
  47.         clone = CloneTagList( orig );
  48.  
  49.         \* In between here we do something to the TagItems in clone,
  50.             but we need to have them restored.
  51.         *\
  52.  
  53.         RefreshTagItemClones( clone, orig );
  54.  
  55.     BUGS
  56.         None, however if either of the two pre-conditions is not fulfilled
  57.         then this function will probably be unreliable, or trash memory.
  58.  
  59.         We warned you...
  60.  
  61.     SEE ALSO
  62.         CloneTagItems()
  63.  
  64.     INTERNALS
  65.  
  66.     HISTORY
  67.         29-10-95    digulla automatically created from
  68.                             utility_lib.fd and clib/utility_protos.h
  69.         11-08-96    iaint   Based on the 3.0/2.04 version.
  70.         05-09-96    iaint   Updated autodoc, and removed another variable.
  71.  
  72. *****************************************************************************/
  73. {
  74.     AROS_LIBFUNC_INIT
  75.  
  76.     struct TagItem *current;
  77.  
  78.     if( !clone )
  79.         return;
  80.  
  81.     /* If we don't have an original, but do have a clone, set the
  82.        clone to have a definite end of TagList.
  83.  
  84.        This is because CloneTagItems(NULL) is valid.
  85.     */
  86.     if(!original)
  87.     {
  88.         clone->ti_Tag = TAG_DONE;
  89.         return;
  90.     }
  91.  
  92.     /* Remember, the clone list is a straight memory block, however
  93.         the original list may not be.
  94.     */
  95.     while ((current = NextTagItem (&original)))
  96.     {
  97.         *clone = *current; /* Copies both tag and data */
  98.         clone++;
  99.     }
  100.  
  101.     AROS_LIBFUNC_EXIT
  102. } /* RefreshTagItemClones */
  103.